/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dale2507.gates.gate.comparator;

import dale2507.gates.gate.Gate;

/**
 *
 * @author Dale
 */
public class GateNameComparator implements IGateComparator {

    /**
     * Checks if a gate matches the name. 
     * @param g Gate to check the name of
     * @param item Name of the gate
     * @return true if the gate names match, false otherwise
     */
    @Override
    public boolean check(Gate g, Object item) {
        if (item == null) return false;
        if (!(item instanceof String)) return false;
        if (!g.getSettings().getName().equalsIgnoreCase(String.valueOf(item).trim())) return false;
        return true;
    }
    
}
